import cn.edu.hbsi.dao.DriverDao;
import cn.edu.hbsi.domain.Driver;
import cn.edu.hbsi.utils.GetSqlSessionUtil;
import org.apache.ibatis.session.SqlSession;
import org.junit.After;
import org.junit.Test;

public class testDriver
{
    private SqlSession sqlSession = GetSqlSessionUtil.getSqlSession();
    private DriverDao driverDao = sqlSession.getMapper(DriverDao.class);

    @Test
    public void testselectDriverByDId(){
        //查询id为2的司机的信息
        System.out.println(driverDao.selectDriverByDId(2));
    }

    @Test
    public void testUpdateDriverByDId(){
        //修改id为3的司机的姓名修改为李天，年龄修改为32
        if(driverDao.updateDriverByDId(new Driver(3,"李天",32,null,null)) > 0){
            System.out.println("修改成功");
        }else{
            System.out.println("修改失败");
        }
    }

    @After
    public void destory(){
        sqlSession.commit();
        sqlSession.close();
    }
}
